<?php
include '../connect/common_start.php';
if(isset($_REQUEST['mem_id']))
{
	$mem_id=$_REQUEST['mem_id'];
	if(isset($_REQUEST['post_id']))
	{
		$post_id=$_REQUEST['post_id'];
		if(isset($_REQUEST['type']))
		{
			$type=$_REQUEST['type'];		
			$result=mysql_query("INSERT INTO `like` (`id_mem`, `id_post`, `like`, `datetime`) VALUES ('$mem_id', '$post_id', '$type', NOW())");
			$rs=mysql_affected_rows();
			if($rs>0)
			{
				$sql="UPDATE `post` SET `likes`=`likes`+'$type' WHERE (`id`='$post_id')";	
				$result1=mysql_query($sql);
			}
			echo $rs;
		}
	}
}
include '../connect/common_end.php';
?>
